package com.hoas.quickstart.threads.chapter02.chapter02_2_11_02;

public class Run {

    public static void main(String[] args) {
        Service service = new Service();

        System.out.println("通过 synchronized(x){}表达式，可以防止一个对象的两个方法同时抢占对象锁");

        ThreadA a = new ThreadA( service );
        a.setName("A");
        a.start();

        ThreadB b = new ThreadB( service );
        b.setName("B");
        b.start();
    }

}
